package com.course.controller;

import com.course.component.http.Crp;
import com.course.component.http.requ.RequestArticle;
import com.course.component.http.requ.RequestCategory;
import com.course.masterservice.CategoryMasterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Copyright: Copyright (c)  林中小鸟  All rights reserved.
 * @author: moon
 * @date: 2022/9/17 11:03
 * @Description: **********************
 */
@RestController
@RequestMapping(value = "/x/category")
public class CategoryController {

    @Autowired
    private CategoryMasterService categoryMasterService;

    @GetMapping(value = "list")
    public Crp list(RequestCategory requestCategory){
        return Crp.success(categoryMasterService.getPageList(requestCategory));
    }

    @DeleteMapping(value = "del")
    public Crp del(@RequestBody  RequestCategory requestCategory){
        return Crp.success(categoryMasterService.del(requestCategory));
    }

    @PostMapping(value = "edit")
    public Crp edit(@RequestBody  RequestCategory requestCategory){
        return Crp.success(categoryMasterService.update(requestCategory));
    }
}
